#include "exti.h"
#include "stm32f10x.h"
//外部中断初始化函数
void EXTIX_Init(void)
{
 	EXTI_InitTypeDef EXTI_InitStructure;
 	NVIC_InitTypeDef NVIC_InitStructure;
  	RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO,ENABLE);/*外部中断，需要使能AFIO时钟*/
	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
	KEY_Init ();//初始化按键对应io模式
    //GPIOD.0	  中断线以及中断初始化配置
  	GPIO_EXTILineConfig(GPIO_PortSourceGPIOD,GPIO_PinSource0);
  	EXTI_InitStructure.EXTI_Line=EXTI_Line0;
  	EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;	
  	EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
  	EXTI_InitStructure.EXTI_LineCmd = ENABLE;
  	EXTI_Init(&EXTI_InitStructure);	  /*根据EXTI_InitStruct中指定的参数初始化外设EXTI寄存器*/
	NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn;/*使能按键所在的外部中断通道*/
  	NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;//抢占优先级0， 
  	NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;	//子优先级0
  	NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;								//使能外部中断通道
  	NVIC_Init(&NVIC_InitStructure); 
}	
